<?php

namespace ApplicationTest\Controller;


use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
use Application\Model\Sejour;
use Application\Model\SejourTable;
use Zend\Db\ResultSet\ResultSet;

/**
 * IndexController
 *
 * @author
 *
 * @version
 *
 */
class IndexControllerTest extends AbstractHttpControllerTestCase {
	protected $traceError = true;
	
	public function setUp()
    {
        $this->setApplicationConfig(
            include 'D:\Developpement\workspace\zf2randos\config\application.config.php'
        );
        
        parent::setUp();
    }
    
    public function testIndexActionCanBeAccessed()
    {
    	$service = 'Application\Model\SejourTable';
    	
    	$albumTableMock = $this->getMockBuilder($service)
    		->disableOriginalConstructor()
    		->getMock();
    	
    	$albumTableMock->expects($this->once())
    		->method('fetchAll')
    		->will($this->returnValue(array()));
    	
    	$serviceManager = $this->getApplicationServiceLocator();
    	$serviceManager->setAllowOverride(true);
    	$serviceManager->setService($service, $albumTableMock);
    	
    	$this->dispatch('/');
    	$this->assertResponseStatusCode(200);
    	$this->assertModuleName('Application');
    	$this->assertControllerName('Application\Controller\Index');
    	$this->assertControllerClass('IndexController');
    	$this->assertMatchedRouteName('home');
    }
}